import Route from './Route'

export default class RouteModules {
  public parentPath: string
  public routeList: { [key: string | number]: Route } | Route[]

  constructor(parentPath: string, routeList: { [key: string | number]: Route } | Route[] = []) {
    this.parentPath = parentPath
    // 处理list将parentPath -> 补充到list->item下

    for (const route of Array.isArray(routeList) ? routeList : Object.values(routeList)) {
      route.path = parentPath + route.path
    }
    this.routeList = routeList
  }
}
